package cn.fan.feign.clients.fallback;

import cn.fan.feign.clients.FundClient;
import cn.fan.feign.pojo.FundMain;
import cn.fan.utils.R;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

@Slf4j
public class FundClientFallbackFactory implements feign.hystrix.FallbackFactory<FundClient> {
    @Override
    public FundClient create(Throwable throwable) {
        return new FundClient() {
            @Override
            public R getByCode(String code) {
                log.error("查询基金信息失败！",throwable);
                return R.error();
            }

            @Override
            public FundMain selectByCode(String code) {
                log.error("查询基金信息失败！",throwable);
                return new FundMain();
            }

            @Override
            public R list(FundMain fundMain) {
                log.error("查询基金信息失败！",throwable);
                return R.error();
            }

            @Override
            public R list(Map<String, Object> map) {
                log.error("查询基金信息失败！",throwable);
                return R.error();
            }

        };
    }
}
